package com.ihealthway.all.task;

import org.nutz.log.Log;
import org.nutz.log.Logs;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Asynchronous submit task to thread
 *
 * @author 凡梦星尘(elkan1788@gmail.com)
 */
public class ExecutorThreadPool {

    private static final Log logger = Logs.get();

    private static final ExecutorService THREAD_POOL = Executors.newFixedThreadPool(5);

    public static void execute(Runnable task) {
        try {
            THREAD_POOL.execute(task);
        } catch (Exception e) {
            logger.error("Execute thread pool task failure.", e);
        }
    }
}
